package com.mars.demo01.config;

import com.mars.demo01.bean.Client;
import com.mars.demo01.bean.HostA;
import com.mars.demo01.bean.HostB;
import com.mars.demo01.bean.ProxyP;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyConfig {

    @Bean// 返回值就是Bean类型，方法名是bean的id
    public HostA hostA(){
        return new HostA();
    }

    @Bean
    public HostB hostB(){
        return new HostB();
    }

    @Bean
    public ProxyP proxy(){
//        怎么引用其他bean？？？
        return new ProxyP(new HostA());
    }

    @Bean
    public Client client(){
        return new Client();
    }

}
